]> dgit.raspbian.org Git - gnome-shell.git/commit
screenShield: Don't unnecessarily close or recreate inhibitors
authorSebastian Keller <skeller@gnome.org>
Fri, 23 Jul 2021 15:35:00 +0000 (17:35 +0200)
committerMarge Bot <marge-bot@gnome.org>
Mon, 16 Aug 2021 00:28:52 +0000 (00:28 +0000)
commitfb313033eaf97fe072850f1bda5cb6eaf02c0312
treecab8b1a2135116d4bddb4d461eb59d05591618fd
parent4a3e3ee1b8326f642eee4825cf2516fc09290dd7
screenShield: Don't unnecessarily close or recreate inhibitors

ScreenShield::_syncInhibitor() was closing (and recreating) the
inhibitor everytime it was called, even if no change was needed.
This gets called in various places, including on property changes in
the login1 dbus object. These happen by the time logind already started
suspending at which point new inhibitors can no longer be created. It is
only waiting for existing inhibitors to be closed, so closing the
inhibitor without a new inhibitor will cause the suspending to proceed
immediately if no other inhibitors are present. This can also happen
before the lock screen is shown, which will then complete after resume.

Fix this by keeping track of the expected inhibition state and only
create or close inhibitors if there was a change to that.

Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3736

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1927>
js/ui/screenShield.js